import React from "react";
import {Map} from "react-amap";
import BaseComponent from "components/Base/BaseComponent";


export default class extends BaseComponent {

  render() {

    const events = {
      created: (ins) => {console.log('Map', ins)},
      click: () => {console.log('You Clicked The Map')}
    }

    const plugins = [
      'Scale',
      {
        name: 'ToolBar',
        options: {
          visible: true,  // 不设置该属性默认就是 true
          onCreated(ins){
            console.log(ins);
          },
        },
      }
    ];

    const mapProps = {
      version: '1.4.15',
      amapkey: '2d414d215b304de20e3863a1bc3afc76',
      plugins,
      events,
      ...this.props,
    }

    return (
      <Map {...mapProps}>
        {this.props.children}
      </Map>
    );
  }

}
